function A = pulseshape(T,delta_T,shape_factor,energy)  
    if (shape_factor == 1)
                T_0 = delta_T/1.665;
                P = energy/trapz(T,(exp(-0.5*(T/T_0).^2)).^2);
                A = sqrt(P)*exp(-0.5*(T/T_0).^2);
    end
     
    if (shape_factor == 2)
                T_0 = delta_T/1.763;
                P = energy/trapz(T,(sech(T/T_0)).^2);
                A = sqrt(P)*sech(T/T_0);
    end
    
    
    